home *** CD-ROM | disk | FTP | other *** search
- #ifndef SMARTDRAGWINDOW_H_
- #define SMARTDRAGWINDOW_H_
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*
- SmartDragWindow().
-
- The default action for SmartDragWindow() is to stick to the monitor
- edges only. For other actions, use SuperSmartDragWindow() instead.
-
- Keeping down the control key during the start of the drag disables the
- snap action and makes SmartDragWindow act exactly like DragWindow.
-
- The arguments to SmartDragWindow() are almost the same as DragWindow()...
-
- However, for <limitRect> you can (and most of the times should) pass an
- argument of NULL or nil. Almost all of the time the argument to the
- <limitRect> parameter for DragWindow is either screenBits.bounds or
- (**GetGrayRgn()).rgnBBox.
- So, to make your life easier just pass NULL for <limitRect> and
- SmartDragWindow() will determine the limit rect *for you*.
- I have kept the <limitRect> argument for those of you who wish
- to use non-standard limit rects.
-
- If not NULL, <limitRect> should be in global coordinates.
- */
-
- void SmartDragWindow(
- WindowRef windowToDrag,
- Point startPoint,
- const Rect *limitRect,
- short snapToDistance);
-
- Boolean IsCmdKeyDown();
- Boolean IsControlKeyDown();
-
- // ---------------------------------------------------------------------------
-
- typedef void (*SnapCallback)(WindowPtr windowToDrag, short snapToDistance, Rect *snapRect);
-
- /*
- If you pass NULL to <snapProc>, SuperSmartDragWindow() acts
- just like DragWindow().
- */
- void SuperSmartDragWindow(
- WindowRef windowToDrag,
- Point startPoint,
- const Rect *limitRect,
- short snapToDistance,
- SnapCallback snapProc);
-
- /*
- 3 predefined snap procs. If you want to use all of them, just declare
- your own snap proc which in turn calls all three below.
- */
- void MonitorSnapProc(WindowPtr windowToDrag, short snapToDistance, Rect *snapRect);
- void WindowSnapProc(WindowPtr windowToDrag, short snapToDistance, Rect *snapRect);
- void GridSnapProc(WindowPtr windowToDrag, short gridSize, Rect *snapRect);
-
-
- #ifdef __cplusplus
- }
- #endif
-
-
- #endif // SMARTDRAGWINDOW_H_